package jiuqi.service.impl;

import jiuqi.dao.LoginAndRegisterDao;
import jiuqi.pojo.LoginAndRegister;
import jiuqi.service.LoginAndRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginAndRegisterServiceImpl implements LoginAndRegisterService {

    @Autowired
    private LoginAndRegisterDao loginAndRegisterDao;

    @Override
    public boolean login(LoginAndRegister loginAndRegister) {
        System.out.println("Impl 登录");
        return loginAndRegisterDao.login(loginAndRegister) == null ? false : true;
    }

    @Override
    public boolean register(LoginAndRegister loginAndRegister) {
        System.out.println("Impl 注册");
        return loginAndRegisterDao.register(loginAndRegister) > 0 ? true : false;
    }

    @Override
    public boolean exitUsername(LoginAndRegister loginAndRegister) {
        System.out.println("Impl 检查");
        return loginAndRegisterDao.exitUsername(loginAndRegister) == null ? false : true;
    }
}
